'use strict';
module.exports = app => {
  const { STRING, INTEGER, TEXT } = app.Sequelize;
  const Active = app.model.define(
      'active',
      {
          id: {type: INTEGER, primaryKey: true, autoIncrement: true},
          name: STRING(255),
          cehua_doc: STRING(255),
          news_doc: STRING(255),
          img_1: STRING(255),
          img_2: STRING(255),
          img_3: STRING(255),
          xuanchuan_img: STRING(255),
          user_id: INTEGER(11)
      },
      {
          tableName: 'active',
          timestamps: true, // 启用时间戳(createdAt, updatedAt)
          updatedAt: 'updated_time', // 不想要 updatedAt
          createdAt: 'create_time', // 想要  createdAt 但是希望名称叫做 created_at
      }
  );
    Active.associate = function () {
        Active.belongsTo(app.model.Member, { foreignKey: 'user_id', targetKey: 'id'})
    }
    return  Active
};
